package swing.demo;

import swing.util.SwingConsle;

import javax.swing.*;
import java.awt.*;

public class Calendar extends JFrame {
    private JPanel searchPanel, contextPanel;

    private JButton searchButton = new JButton("查询");
    private JTextField searchTextField = new JTextField(30);

    private JTextField dateTextField = new JTextField(70);
    private JTextField animalsYearTextField = new JTextField(70);
    private JTextField lunarYearTextField = new JTextField(70);
    private JTextField suitTextField = new JTextField(70);
    private JTextField avoidTextField = new JTextField(70);
    private JTextField holidayYearTextField = new JTextField(70);

    public Calendar(){
        searchPanel = new JPanel();
        searchPanel.add(searchTextField);
        searchPanel.add(searchButton);

        contextPanel = new JPanel();
        contextPanel.setLayout(new FlowLayout());
        contextPanel.add(new JLabel("日 期"));
        contextPanel.add(dateTextField);

        contextPanel.add(new JLabel("动物年"));
        contextPanel.add(animalsYearTextField);

        contextPanel.add(new JLabel("太阴年"));
        contextPanel.add(lunarYearTextField);

        contextPanel.add(new JLabel("事 宜"));
        contextPanel.add(suitTextField);

        contextPanel.add(new JLabel("禁 忌"));
        contextPanel.add(avoidTextField);

        contextPanel.add(new JLabel("节 日"));
        contextPanel.add(holidayYearTextField);

        setLayout(new BorderLayout());
        add(searchPanel, BorderLayout.NORTH);
        add(contextPanel, BorderLayout.CENTER);
    }

    public static void main(String[] args) {
        SwingConsle.run(new Calendar(), 500, 280);
    }
}
